#ifndef _LOCKERS_H_CSEAPI_
#define _LOCKERS_H_CSEAPI_

#include "CseApi/CseTypes.h"

#if defined(__VISUALC__) || defined(__MINGW32__)
  #define CRITICAL_SECT_SIZE     (sizeof(TInt) > sizeof(TInt32)? 40: 24)
  typedef struct { char buff[CRITICAL_SECT_SIZE]; } CRITICAL_TYPE_;

#elif defined(__GNUC__)
  #include <pthread.h>
  typedef pthread_mutex_t          CRITICAL_TYPE_;

#else
  #error "Unknown C++ compiler!"   // other compiler not support yet
#endif

class CSE_IMPEXP_IN TCriticalSection
{
private:
    CRITICAL_TYPE_ m_critical;

    // copy constructor and copy assign is disabled
    TCriticalSection(const TCriticalSection&);
    TCriticalSection& operator=(const TCriticalSection&);

public:
    TCriticalSection();
    ~TCriticalSection();

    void enter();
    void leave();
};

#endif
